-
Notifications
You must be signed in to change notification settings - Fork 623
✨ Add support for EKSConfig LaunchTemplate bootstrapping for AL2023 using nodeadm #5553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
✨ Add support for EKSConfig LaunchTemplate bootstrapping for AL2023 using nodeadm #5553
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @AmitSahastra. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
/test pull-cluster-api-provider-aws-e2e-blocking |
119ecfe
to
7acf4c3
Compare
LGTM. Running this in my dev environment. So far no further issues. |
@AmitSahastra bit curious about the use of Really appreciate your work on this, looking forward to having it out soon! |
Had you enable launch template in AWSMMP it should create EKS config. |
Aye we are using launch templates in our managed machine pools using the AWSLaunchTemplate parameter. Pretty certain no corresponding EKSConfig objects are being created - because I don't see any on our management cluster - hence my question around whether one needs to create EKSConfig objects for each cluster. |
Yes, for AL2023 support via CAPA, I added logic that uses nodeType: al2023 inside EKSConfig to generate the correct nodeadm-style userdata. So if you’re planning to switch to AL2023 and rely on CAPA for bootstrap, then yes, you’ll need to start creating EKSConfig objects with that field set. As for existing AL2-based nodegroups, there’s no impact — they can stay as-is with your current launch templates and don’t require any changes unless you explicitly migrate them to AL2023. I hope that answers your question. |
That's baller - thanks a ton @AmitSahastra, appreciate you! |
I have built and tested this PR on a sandbox environment for our use case.
Example YAML---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: test-3723977939
namespace: flux-system
spec:
template:
spec:
ami:
eksLookupType: AmazonLinux2023
instanceMetadataOptions:
httpTokens: required
httpPutResponseHopLimit: 2
iamInstanceProfile: test-capa-nodes
instanceType: t4g.medium
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: EKSConfigTemplate
metadata:
name: test-al2023
namespace: flux-system
spec:
template:
spec:
nodeType: al2023
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: t00-use1-eks-test-us-east-1a-md0
namespace: flux-system
spec:
clusterName: test
template:
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
kind: EKSConfigTemplate
name: test-al2023
clusterName: test
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
name: test-3723977939
version: v1.32.3 CAPA LogsI0804 13:55:29.740725 1 eksconfig_controller.go:265] "Generating userdata"
I0804 13:55:29.740740 1 eksconfig_controller.go:314] "Processing AL2023 node type"
I0804 13:55:29.741301 1 eksconfig_controller.go:366] "Generating AL2023 userdata"
I0804 13:55:29.748003 1 eksconfig_controller.go:443] "created bootstrap data secret for EKSConfig"
I0804 13:55:29.766772 1 eksconfig_controller.go:197] "joinWorker called" [repeated multiple times, without success] The instance is launched successfully, but with previous metadata format and so, it's not able to connect: I0804 13:55:30.090681 1 awsmachine_controller.go:732] "Creating EC2 instance"
I0804 13:55:30.306418 1 instances.go:135] "Obtained a list of supported architectures for instance type" [...] supported architectures=["arm64"]
I0804 13:55:30.307461 1 instances.go:135] "Chosen architecture" [...] instance type="t4g.medium" supported architectures=["arm64"] architecture="arm64"
I0804 13:55:30.353337 1 ami.go:374] "found AMI" [...] id="ami-0cbd69473baf7c079" version="1.32"
I0804 13:55:32.550263 1 awsmachine_controller.go:578] "EC2 instance state changed" state="pending" instance-id="i-xxx
I0804 13:56:03.485209 1 awsmachine_controller.go:578] "EC2 instance state changed" state="running" instance-id="i-xxx"
EDIT: It works when disabling Secrets Manager on user metadata in @@ -11,6 +11,8 @@
{{- else }}
eksLookupType: AmazonLinux2023
{{- end }}
+ cloudInit:
+ insecureSkipSecretsManager: true
instanceMetadataOptions:
httpTokens: required
httpPutResponseHopLimit: 2 |
@AmitSahastra I've done a review with a commit on my fork https://github.com/mloiseleur/cluster-api-provider-aws/tree/al2023-launch-template What I've done:
May I invite you to add it to your PR ? You can apply this file or cherrypick from my branch. |
Thanks @mloiseleur for the detailed review and improvements! I’ve cherry-picked your changes on maxPods, clusterDNS, and the node-labels refactor, and added them to the PR. Also appreciated the test validation and doc additions. 🙌 |
@AmitSahastra: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
expectErr: false, | ||
verifyOutput: func(output string) bool { | ||
return strings.Contains(output, "cidr: 192.168.0.0/16") && | ||
strings.Contains(output, "maxPods: 58") && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings.Contains(output, "maxPods: 58") && | |
strings.Contains(output, "maxPods: 110") && |
It should be 110 when useMaxPods is set.
That should fix the CI.
@@ -24,6 +24,9 @@ import ( | |||
|
|||
// EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration. | |||
type EKSConfigSpec struct { | |||
// NodeType specifies the type of node (e.g., "al2023") | |||
// +optional | |||
NodeType string `json:"nodeType,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to derive this from the AMI being used rather than asking the user to specify in the API?
// EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration. | ||
type EKSConfigSpec struct { | ||
// NodeType specifies the type of node (e.g., "al2023") | ||
// +optional | ||
NodeType string `json:"nodeType,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only required when using AL2023 so perhaps let's add an enum for this and only accept al2023
? Something like this:
// EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration. | |
type EKSConfigSpec struct { | |
// NodeType specifies the type of node (e.g., "al2023") | |
// +optional | |
NodeType string `json:"nodeType,omitempty"` | |
// +kubebuilder:validation:Enum=al2023 | |
type NodeType string | |
const ( | |
NodeTypeAL2023 = "al2023 | |
) | |
// EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration. | |
type EKSConfigSpec struct { | |
// NodeType specifies the type of node (e.g., "al2023") | |
// +optional | |
NodeType NodeType `json:"nodeType,omitempty"` |
Description
This PR adds support for using launch template EKSConfig bootstrapping for Amazon Linux 2023 nodes. The EKSConfig controller now able to create bootstrap datasecrete with nodeConfig that will enable using AL2023 images with LaunchTemplates.
Changes
Testing
Impact
These changes allow users to use launch templates with AL2023 images. Also to specify custom AMIs through launch templates while maintaining compatibility with CAPA's auto AMI lookup mechanism.
Related Issues
Fixes #5546
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Checklist:
Release note: